/*******************************************************************************
 * Copyright (c) 2004, 2005 Jean-Michel Lemieux, Jeff McAffer and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Hyperbola is an RCP application developed for the book
 *     Eclipse Rich Client Platform -
 *         Designing, Coding, and Packaging Java Applications
 *         (http://eclipsercp.org)
 * Contributors:
 *     Jean-Michel Lemieux and Jeff McAffer - initial implementation
 *******************************************************************************/
package org.reliablesource.prism.ui.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.preference.PreferenceNode;
import org.eclipse.swt.widgets.Shell;
import org.reliablesource.prism.ui.preferences.PrismPreferencePage;

public class OpenPreferencesAction extends Action {
	
	private final Shell shell;

	public OpenPreferencesAction(Shell shell) {
		this.shell = shell;
		setText("&Preferences...");
		setToolTipText("Open the preferences dialog");	
	}
	
	public void run() {
		PreferenceManager manager = new PreferenceManager();
		PreferenceNode node1 = new PreferenceNode("org.reliablesource.prism.ui.prefs", new PrismPreferencePage());
		manager.addToRoot(node1);
		PreferenceDialog dialog = new PreferenceDialog(shell, manager);
		dialog.open();
	}
}
